package BookDB;


import java.util.List;
import java.sql.SQLException;
import java.sql.Timestamp;
import BookCreated.BookCalnumsBean;

public class BookBean {

	private String bookid;
	private String isbn;
	private String bookname;
	private String calid;
	private boolean status;
	private String location;

	public BookBean() {
	}

	public BookBean(String bookid, String isbn, String bookname, String calid,
			boolean status, String location) {
		this.isbn = isbn;
		this.bookname = bookname;
		this.calid = calid;
		this.status = status;
		this.location = location;
		this.bookid = bookid;
	}

	public String getAreatypeHTML() throws SQLException {
		List<String> list = h2DAO.getAllBookLoction();
		String A = "<option value=\"" + list.get(0) + "\">" + list.get(0)
				+ "</option>";
		for (int i = 1; i < list.size(); i++) {
			if (!list.get(i).equals(list.get(i - 1))) {
				A = A + "<option value=\"" + list.get(i) + "\">" + list.get(i)
						+ "</option>";
			}
		}
		return A;

	}

	public String getBookid() {
		return bookid;
	}

	public void setBookid(String bookid) {
		this.bookid = bookid;
	}

	public String getLocation() {
		return location;
	}

	public void setLocation(String location) {
		this.location = location;
	}

	public String getIsbn() {
		return isbn;
	}

	public void setIsbn(String isbn) {
		this.isbn = isbn;
	}

	public String getBookname() {
		return bookname;
	}

	public void setBookname(String bookname) {
		this.bookname = bookname;
	}

	public String getCalid() {
		return calid;
	}

	public void setCalid(String calid) {
		this.calid = calid;
	}

	public boolean isStatus() {
		return status;
	}

	public void setStatus(boolean status) {
		this.status = status;
	}

	public Timestamp returndate() {
		Timestamp retime = null;
		try {
			retime = h2DAO.getReturnTime();
			return retime;
		} catch (SQLException e) {
			e.printStackTrace();
			return null;
		}
	}
	
	public String getCalDesp() throws SQLException
	{		
	    String caldesp=h2DAO.getCalidDesp(this.getCalid());		
		return caldesp;
	}

}
